package com.qk.mapper;

import com.qk.entity.Activity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public  interface ActivityMapper {
    @Insert("insert into activity(channel,name,start_Time,end_Time,description,type,discount,voucher,create_Time,update_Time ) " +
            "values(#{channel},#{name},#{startTime},#{endTime},#{description},#{type},#{discount},#{voucher},#{createTime},#{updateTime})")
      void insert(Activity activity);


    List<Activity> list(Integer channel, Integer type, Integer status);


    @Delete("delete from activity where id=#{id}")
    void delete(Integer id);

    @Select("select id,channel,name,start_Time,end_Time,description,type,discount,voucher,create_Time,update_Time from activity where id= #{id}")
    Activity getById(Integer id);

    void update(Activity activity);

    @Select("select id,channel,name,start_Time,end_Time,description,type,discount,voucher,create_Time,update_Time from activity where type=#{type}")
    List<Activity> findByType(Integer type);
}
